/*
 * @Description: 
 * @Author: 平常心
 * @Date: 2024-09-19 14:52:28
 * @LastEditors: 平常心
 * @LastEditTime: 2024-09-19 15:16:08
 * @FilePath: \java\day18\Test03.java
 * 至若春和景明
 */
public class Test03 {
    public static void main(String[] args) {
        //向上转型 子类对象指向父类引用
        Base base = new Derived();
        //访问成员变量
        System.out.println("base.n: " + base.n);
        //System.out.println("base.v: " + base.v);
        base.show();
        //base.disp();

        //向下转型
        Derived d = (Derived) base;
        //访问成员变量
        System.out.println("d.n: " + d.n);
        System.out.println("d.v: " + d.v);
        d.show();
        d.disp();

        Fork f = (Fork) base;
        f.out();
    }
}